﻿using MySql.Data.MySqlClient;
using System;

namespace com.orange.examination
{
    public class CheckExist
    {
        //检查用户是否已经存在
        //*******************************************************************************************************************************
        public static bool CheckStudentExist(string studentNum) //检查学生是否存在
        {
            MySqlConnection conn =BaseClass.DBCon();
            conn.Open();
            MySqlCommand cmd = new MySqlCommand("select count(*) from tb_Student where StudentNum='" + studentNum + "'", conn);
            int i = Convert.ToInt32(cmd.ExecuteScalar());
            conn.Close();
            if (i > 0)
            {
                return true;
            }
            else
            {
                return false;
            }

        }
        //============================================================================================
        public static bool CheckTeacherExist(string teacherNum)//检查教师是否存在
        {
            MySqlConnection conn = BaseClass.DBCon();
            conn.Open();
            MySqlCommand cmd = new MySqlCommand("select count(*) from tb_Teacher where TeacherNum='" + teacherNum + "'", conn);
            int i = Convert.ToInt32(cmd.ExecuteScalar());
            conn.Close();
            if (i > 0)
            {
                return true;
            }
            else
            {
                return false;
            }

        }
    }
}